package com.mmall.concurrent.example.threadPool;/**
 * Created with IDEA
 * Author : wangfei
 * Date :  2019/10/22
 * Time : 15:54
 * Describe :
 */

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @ClassName TreadPoolExample1
 * @Describe :
 * @Author : wangfei 
 * @Date :  2019/10/22 15:54
 */
@Slf4j
public class TreadPoolExample3 {
	public static void main(String[] args) {
		ExecutorService executorService = Executors.newSingleThreadExecutor();

		for (int i = 0; i < 10; i++) {
			final int index = i;
			executorService.execute(new Runnable() {
				@Override 
				public void run() {
					log.info("task: {}", index);
				}
			});

		}
		executorService.shutdown();

	}
}
